@namespace SwashbucklerDiary.Rcl.Pages
@inherits FocusDialogComponentBase

<CustomMDialog MyValue="Visible"
               MyValueChanged="VisibleChanged"
               ContentClass="rounded-lg"
               MaxWidth="480"
               DisableAutoFocus
               OnAfterShowContent="FocusAsync"
               OnBeforeShowContent="BeforeShowContent">
    <MForm @ref="@MForm"
           Model="@configModel"
           OnValidSubmit="HandleOnOK"
           EnableI18n="true">
        <MCard>
            <MCardTitle Class="font-weight-bold flex-nowrap">
                <wc-auto-scroll-text>@(I18n.T("Setting"))</wc-auto-scroll-text>
                <MSpacer></MSpacer>
                <MButton Icon="true" OnClick="HandleOnCancel">
                    <MIcon>close</MIcon>
                </MButton>
            </MCardTitle>
            <MCardText Class="pb-0">
                <MTextField @bind-Value="configModel.DeviceName"
                            @ref="textField"
                            Dense
                            MinHeight="48"
                            Filled
                            Rounded
                            spellcheck="false"
                            Placeholder="@(I18n.T("Device name"))">
                </MTextField>
                <MTextField @bind-Value="configModel.ScanPort"
                            Type="number"
                            TValue="int"
                            Dense
                            MinHeight="48"
                            Filled
                            Rounded
                            spellcheck="false"
                            Placeholder="@(I18n.T("Scan port"))"
                            NumberProps="@(prop => { prop.Min = 1204; prop.Max = 65535; prop.HideControl = true; })">
                </MTextField>
                <MTextField @bind-Value="configModel.TransmissionPort"
                            Type="number"
                            TValue="int"
                            Dense
                            MinHeight="48"
                            Filled
                            Rounded
                            spellcheck="false"
                            Placeholder="@(I18n.T("Transmission port"))"
                            NumberProps="@(prop => { prop.Min = 1204; prop.Max = 65535; prop.HideControl = true; })">
                </MTextField>
            </MCardText>
            <MCardActions Class="pt-0">
                <MButton Text="true" OnClick="OnReset">
                    <wc-auto-scroll-text style="max-width:100px;">@(I18n.T("Restore the default"))</wc-auto-scroll-text>
                </MButton>
                <MSpacer></MSpacer>
                <MButton Text="true" OnClick="HandleOnCancel">
                    @(I18n.T("Cancel"))
                </MButton>
                <MButton Text="true"
                         Type="submit"
                         Color="primary">
                    @(I18n.T("OK"))
                </MButton>
            </MCardActions>
        </MCard>
    </MForm>
</CustomMDialog>
